/*
 *@(#)RowMapperForUsers.java 1.0 Mar 10, 2008
 *Copyright Fution Bai
 *
 */
package codebush.service.support.rowMapper;

import org.springframework.jdbc.support.rowset.SqlRowSet;

import codebush.domain.Users;

/**
 *
 * @author Fution Bai
 * @since 1.0
 */
public class RowMapperForUsers {
	private static RowMapperForUsers rowMapperForUsers;
	static {
		rowMapperForUsers = new RowMapperForUsers();
	}

	public static RowMapperForUsers getInstance() {
		return rowMapperForUsers;
	}

	private RowMapperForUsers() {
		;
	}
	
	public Users mapRow(SqlRowSet srs, int rowNum){
		Users users = new Users();
		while(srs.next()){
			users.setId(srs.getInt("id"));
			users.setPassword(srs.getString("password"));
			users.setEmail(srs.getString("email"));
			users.setName(srs.getString("name"));
			users.setEnabled(srs.getString("enabled"));
			users.setSignup_time(srs.getDate("signup_time"));
			users.setLast_view_time(srs.getDate("last_view_time"));
			users.setSex(srs.getBoolean(9));
			users.setCurrent_place(srs.getString(10));
		}
		return users;
	}
	public Users mapRow(SqlRowSet srs){
		return mapRow(srs, 0);
	}
}
